<?php
include_once dirname(dirname(dirname(__FILE__))) . '/shared/db_connection.php';

function getAllNews() {
    $con = open_connect();
    //run the store proc
    $result = mysqli_query($con, "SELECT * FROM tblNews") 
            or die("Query fail: " . mysqli_error());
    
    $list = array();
    $count = 0;
    while($row = mysqli_fetch_array($result))
    {
            $item = array();
            $item["News_Id"] = $row['News_Id'];
            $item["News_Title"] = $row['News_Title'];
            $item["News_Description"] = $row['News_Description'];
            $item["Addedon"] = $row['Addedon'];
            $list[$count] = $item;
            $count = $count + 1;
    }
    
    close_connect($con);
    return $list;
}
